package cn.xxstudy.visitshop.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import cn.xxstudy.visitshop.R
import cn.xxstudy.visitshop.base.adapter.BaseAdapter
import cn.xxstudy.visitshop.databinding.ItemInterviewBinding
import cn.xxstudy.visitshop.ui.activity.main.fragment.interview.model.InterviewData
import kotlinx.android.synthetic.main.item_visit.view.*

/**
 * @author ：DELL on 2021/3/25 .
 * @packages ：cn.xxstudy.visitshop.adapter .
 * TODO:一句话描述
 */
class InterviewAdapter : BaseAdapter<InterviewData, InterviewAdapter.InterviewViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InterviewViewHolder {

        val binding = DataBindingUtil.inflate(
            LayoutInflater.from(parent.context),
            R.layout.item_interview,
            parent,
            false
        ) as ItemInterviewBinding
        return InterviewViewHolder(binding.root)
    }

    override fun onBindViewHolder(holder: InterviewViewHolder, position: Int) {
        super.onBindViewHolder(holder, position)
        val binding = DataBindingUtil.getBinding<ItemInterviewBinding>(holder.itemView)
        binding?.interviewData = datas[position]
        binding?.executePendingBindings()
    }

    inner class InterviewViewHolder(rootView: View) : RecyclerView.ViewHolder(rootView)
}